﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using assignment2.Exceptions;
using assignment2.Entity;
using assignment2.Events;

namespace assignment2.Entity
{
    internal delegate void BigMoneyEventHandler(BigMoneyArgs e);
    internal class ATM
    {
        internal event BigMoneyEventHandler BigMoneyEvent;

        //取款
        public void Withdraw(double amount, CreditAccount creditAccout) 
        {
            //检测是否为大额取款
            if (amount > 10000)
            {
                BigMoneyArgs bigMoneyArgs = new(creditAccout, amount);
                BigMoneyEvent(bigMoneyArgs);
                return;
            }


            creditAccout.Withdraw(amount);
             
        }
    }
}
